import os
import requests
import json
from  dotenv import load_dotenv ,find_dotenv
from openai import OpenAI
from volcenginesdkarkruntime import Ark

_=load_dotenv(find_dotenv("key.env"))


def DS(prompt: str, temperature = 0):#deepseek接口
    client = Ark(
    api_key = os.environ.get("ARK_API_KEY"),
    base_url = "https://ark.cn-beijing.volces.com/api/v3"
    )#配置api
    try:
        completion=client.chat.completions.create(
            model="deepseek-r1-250120",
            messages=[
                {"role":"system","content":"你是人工智能助手"},
                {"role":"user","content":prompt},
            ],
            temperature=temperature,#配置传入包体
        )
    except:
        return "接入AI助手失败"

    return completion.choices[0].message.content

def DB(prompt: str, temperature = 0):#doubao接口
    client = Ark(
    api_key = os.environ.get("ARK_API_KEY"),
    base_url = "https://ark.cn-beijing.volces.com/api/v3"
    )#配置api
    try:
        completion=client.chat.completions.create(
            model="doubao-1.5-pro-32k-250115",
            messages=[
                {"role":"system","content":"你是人工智能助手"},
                {"role":"user","content":prompt},
            ],
            temperature=temperature,#配置传入包体
        )
    except:
        return "接入AI助手失败"

    return completion.choices[0].message.content
